package org.yixiu.consumer;

import java.lang.reflect.Proxy;

/**
 * 客户端生成动态代理对象
 */
public class ConsumerProxy {

    public static <T> T getProxy(final Class<T> interfaceClass,final String host,final int port){
        return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(),
                new Class<?>[]{interfaceClass},
                new ConsumerInvocationHandler(host,port));
    }
}
